<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>


<body>
<h2>JavaScript 创建 JSON 对象</h2>
<p>
  网站名称: <span id="jname"></span><br />
  网站地址: <span id="jurl"></span><br />
  网站 slogan: <span id="jslogan"></span><br />
</p>
<button onmousedown="fun1()">按钮</button>

<script>
  var JSONObject= {
    "name":"菜鸟教程",
    "url":"www.runoob.com",
    "slogan":"学的不仅是技术，更是梦想！"
  };

  text = JSON.parse(JSONObject);

  function fun1() {
    alert("text");
    console.log(text);
    document.getElementById("jname").innerHTML=JSONObject.name;
    document.getElementById("jurl").innerHTML=JSONObject.url;
    document.getElementById("jslogan").innerHTML=JSONObject.slogan;
  }

</script>
</body>
</html>